<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div id="main_hasdo_list" class="easyui-layout" fit="true">
	<div region="north" style="padding:0px;border:0px">
       <table style="width: 100%;" cellpadding="0" cellspacing="1"  border="0" class="formtable" align="center">
	       <tr height="40" >
				<td>
				    <label style="padding:2px;"> 工单来源  </label>
				    <select name="woSrc" id="woSrc" style="margin-left:5px;width:120px;" >
					         <option value="">请选择</option>			                                 
					         <option value="A01">95598工单</option>
                              <option value="A02">增值服务</option>
				    </select>
				    <select name="pmd" id="pmd" style="width:90px;">
				         <option value="contactMan">联系人</option>
				         <option value="contactPhone">联系电话</option>
				         <option value="doUsername">处理人员</option>
				         <option value="id">工单编号</option>	
				        
			        </select>
			        <input type="text" name="pmv" id="pmv" style="width:120px;">
			        <label style="padding:2px;"> 创建日期 从  </label> 
			        <input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 100px;" id="startDate"
						      				 name="startDate" ignore="ignore" value=""> 至 
				    <input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 100px;" id="endDate"
						      				 name="endDate" ignore="ignore" value=""> 
			       
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-search"  style="margin-left:5px;" onclick="myquery();" >查 询</a>
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-cancel"  style="margin-left:5px;" onclick="myreset();" >清 空</a>
				</td>
				
			</tr>
		 </table>
	</div>
   <div region="center" style="padding:0px;border:0px">
       
		 
        <t:datagrid name="hasdoWoList" title="已办工单列表"
                    actionUrl="woController.do?hasdoWoGrid"
                    treegrid="false" idField="id" pagination="true" sortOrder="desc" sortName="createDatetime" onLoadSuccess="" pageSize="15">
            <t:dgCol title="工单来源" field="woSrcDesc" width="60" ></t:dgCol>
            <t:dgCol title="编号" field="id" width="60" hidden="true"></t:dgCol>
            <t:dgCol title="工单编号" field="wo95598Id" width="100" ></t:dgCol>
	        <t:dgCol title="联系人 " field="contactMan" width="80" ></t:dgCol>
	        <t:dgCol title="联系电话 " field="contactPhone" width="80" ></t:dgCol>
	        <t:dgCol title="工单状态" field="woStateDesc" width="60" ></t:dgCol>
	        <t:dgCol title="处理人员" field="doUsername" width="60" ></t:dgCol>
	        <t:dgCol title="创建时间 " field="createDatetime"  width="80" formatter="yyyy.MM.dd hh:mm:ss"></t:dgCol>
	        <t:dgCol title="common.operation" field="opt" width="70"></t:dgCol>
            <t:dgFunOpt funname="showWoDetail(id)" title="工单详情"></t:dgFunOpt>            
            <t:dgFunOpt funname="PrintWoURL(id)" title="打印"></t:dgFunOpt>    
        </t:datagrid>
    </div>
</div>


<script language="javascript" src="plug-in/lodop/LodopFuncs.js"></script>

<script type="text/javascript">
    var LODOP; //声明为全局变量 

	$(function() {
		
	    $('#hasdoWoList').datagrid({  
		   onDblClickRow: function (rowIndex, rowData) {  
			   showWoDetail(rowData.id);
		   }
	   });
	    
	});

   function showWoDetail(id){
	   createdetailwindow("工单详情","woController.do?woDetailTabs&wo_id=" + id,1210,600);
		 
   }
   
	function PrintWoURL(id){
 		 LODOP=getLodop();  
		LODOP.PRINT_INIT("工单打印");
		//LODOP.SET_PRINT_PAGESIZE(1,"95%","95%",0,"A4");
		LODOP.ADD_PRINT_URL(20,20,"90%","90%","woController.do?woPrint&wo_id=" + id);
		//LODOP.SET_PREVIEW_WINDOW(2,0,0,0,0,""); //按适宽模式显示

	//	LODOP.SET_PRINT_STYLEA(0,"HOrient",3);
	//	LODOP.SET_PRINT_STYLEA(0,"VOrient",3);
//		LODOP.SET_SHOW_MODE("MESSAGE_GETING_URL",""); //该语句隐藏进度条或修改提示信息
//		LODOP.SET_SHOW_MODE("MESSAGE_PARSING_URL","");//该语句隐藏进度条或修改提示信息
		LODOP.PREVIEW();  			
	};
 
	function myquery(){
		 //字段选项
	    var pmd = $('#pmd').val();
		 //字段值
	    var pmv = $('#pmv').val();
	     //工单来源
	    var woSrc = $('#woSrc').val();
		 
	    //开始日期
	    var startDate = $('#startDate').val();
		 //结束日期
	    var endDate = $('#endDate').val();
		
		$('#hasdoWoList').datagrid({
			queryParams: {
				pmd: pmd,
				pmv: pmv,
				woSrc:woSrc,
				startDate:startDate,
				endDate:endDate
			}
		});

	}
	
	function myreset(){
		$('#woSrc').val('');
		$('#pmv').val('');
		$('#startDate').val('');
		$('#endDate').val('');
	}
	
</script>